<template>
  <el-container>
    <!-- <el-aside :width="wide?'70px':'200px'"> -->
    <el-aside width="'200px'">
      <el-menu default-active="1-4-1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
        <el-submenu index="1">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span slot="title">导航一</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="1-1">选项1</el-menu-item>
            <el-menu-item index="1-2">选项2</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
        <el-menu-item index="2">
          <i class="el-icon-menu"></i>
          <span slot="title">导航二</span>
        </el-menu-item>
        <el-menu-item index="3" disabled>
          <i class="el-icon-document"></i>
          <span slot="title">导航三</span>
        </el-menu-item>
        <el-menu-item index="4">
          <i class="el-icon-setting"></i>
          <span slot="title">导航四</span>
        </el-menu-item>
      </el-menu>
    </el-aside>
    <el-main>
      <div class="topNavigation">
        <span @click="widee">
          <i v-show="!isCollapse" class="el-icon-s-fold"></i>
          <i v-show="isCollapse" class="el-icon-s-unfold"></i>
          后台管理
        </span>
        <div @click="quit">退出</div>
      </div>
      <router-view />
    </el-main>
  </el-container>
</template>

<script>
export default {
  data () {
    return {
      isCollapse: false,
      wide: false
    }
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    },
    quit () {
      localStorage.removeItem('user')
      this.$router.push({ path: '/login' })
    },
    widee () {
      this.wide = !this.isCollapse
      this.isCollapse = !this.isCollapse
    }
  }
}
</script>

<style lang="less" >
.box {
  height: 100%;
}
.el-container {
  height: 100%;
}

.el-menu-vertical-demo {
  height: 100%;
}
.el-header {
  background-color: #1e69cc;
  color: #333;
  line-height: 60px;
}

.el-aside {
  color: #333;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
  margin: 0 !important;
}

.topNavigation {
  display: flex;
  justify-content: space-between;
  height: 50px;
  background: aqua;
}
</style>
